Código fuente de 'Elimina tags HTML.asp'

<html>

<head>
<title>Elimina Tags Html - Códigos asp, programacion asp, descargas asp, rutinas asp</title>
</head>

<body style="font-family: Arial; font-size: 11pt">

<center><b><font face="Arial" size="3">Elimina Tags Html </font></b></center><br><br>
Utiliza la función 'EliminaHTML' para eliminar código HTML del texto. Además, 
puedes especificar qué tags no deseas eliminar, por ejemplo&nbsp; &lt;B&gt; or 
&lt;I&gt;. <br>
<b>Nota: </b>más que eliminar los tags, lo que hace es aplicarlos con lo que la 
cadena de salida vendrá formateada. Ej: &lt;b&gt;Hola&lt;/b&gt; mostraría Hola en negrita.<br>
<br>
<br>
</b>
<!--   '**************************************
    ' Name: Trim HTML from an ASP String (exceptions to certain HTML TAGS)
    ' By: Cyquester Technologies
    ' http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=6568&lngWId=4

    INSTRUCTIONS:
    Call the function from you code like below:
    strResults=EliminaHTML ("Plain Text.<BR><B>Should be bold!</B><BR><B>Should be bold</B><BR><I>should be italics</I><BR><B><I>Bold + italics!</B></I>","b,i,BR")
    In this case, strRestuls will hold the new text. Notice that I have specified 3 tags which I dont want it To remove from the string. You can do as many as you want but remember that you should not put the "<" and ">" around them when calling this function.
    if you want it To remove all HTML tags, Then use then specify "" as the second perimeter when calling the function... heres an example:
    strResults=EliminaHTML ("Plain Text.<BR><B>Should be bold!</B><BR><B>Should be bold</B><BR><I>should be italics</I><BR><B><I>Bold + italics!</B></I>","")
    ---------------------------------------
    --></b>
    
    <%
   ' strResults=EliminaHTML ("Plain Text.<BR><B>Should be bold!</B><BR><B>Should be bold</B><BR><I>should be italics</I><BR><B><I>Bold + italics!</B></I>","")
   ' Response.Write strResults
    
  function EliminaHTML(strHTML,arrDontTrim)
    strHTML=Replace(strHTML,"<","<")
    strHTML=Replace(strHTML,">",">")
    
    if len(arrDontTrim)<>0 Then
    	arrDontTrim=Split(arrDontTrim,",")
		For i = 0 To ubound(arrDontTrim)
		strHTML=Replace(strHTML,"<" & arrDontTrim(i) & ">","<" & arrDontTrim(i) & ">",1, -1, vbTextCompare)
		strHTML=Replace(strHTML,"</" & arrDontTrim(i) & ">","</" & arrDontTrim(i) & ">",1, -1, vbTextCompare)
    Next
    
    End if
    EliminaHTML= strHTML
    
  End function
    %>
<b>Cadena original: </b>&quot;&lt;br&gt;&lt;center&gt;&lt;font face='Arial' size='5'&gt;Evitar caché&lt;/font&gt;&lt;/center&gt;&quot; 
&amp; _<br>
&quot;&lt;i&gt;&lt;/b&gt;&lt;br&gt;Función que permite eliminar los tags de HTML. Se pueden señalar 
excepciones. &lt;b&gt;Ejemplo:&quot; &amp; _<br>
&quot;br, i, u, etc&quot;,&quot;b,i,br&quot;<%
    Response.write "<br><br><b>Cadena resultado:<br></b>"
    Response.write EliminaHTML("<br><center><font face='Arial' size='5'>Evitar caché</font></center>" & _
    "<i></b><br>Función que permite eliminar los tags de HTML. Se pueden señalar excepciones. <b>Ejemplo:" & _
    "br, i, u, etc","b,i,br")
    %></body></html>